﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SettingsPopup : MonoBehaviour
{

    [SerializeField] private Slider speeedSlider;

	// Use this for initialization
	void Start ()
	{
	    speeedSlider.value = PlayerPrefs.GetFloat("speed", 1);
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    public void Open()
    {
        gameObject.SetActive(true);
    }

    public void Close()
    {
        gameObject.SetActive(false);
    }

    //用户在输入域输入时
    public void OnSumbitName(string name)
    {
        Debug.Log(name);
    }

    //用户使用滑动条时
    public void OnSpeedValue(float speed)
    {
//        Debug.Log("Speed:"+speed);
        //把滑动条的值作为<float>事件发送
        Messenger<float>.Broadcast(GameEvent.SPEED_CHANGED, speed);
    }
}
